package net.kelissa.divizor.util.randomdata;

import net.kelissa.divizor.model.DataModel;
import net.kelissa.divizor.util.Const;
import net.kelissa.divizor.util.MathUtil;

public class VeryDifficultDivision extends RandomDataCreator
{
  @Override
  public String getLabel(double x, double y)
  {
    String label = Const.POSITIVE;
    if (((x * x) + (y * y)) > 0.4)
      label = "Negativo";
    return label;
  }

  @Override
  public DataModel createRandomData()
  {
    DataModel dm = new DataModel();
    double x = MathUtil.getDefaultRandom();
    double y = MathUtil.getDefaultRandom();
    boolean done = true;
    while (done)
    {
      if (((x * x) + (y * y)) < 1)
      {
        done = false;
      }
      else
      {
        x = MathUtil.getDefaultRandom();
        y = MathUtil.getDefaultRandom();
      }
    }
    double[] v = { x, y };
    String label = getLabel(x, y);
    dm.setPosition(v);
    dm.setClazzLabel(label);
    return dm;
  }
}
